﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNG.LIB.Common;
using HNG.Portal.BLL;
using HNG.Portal.DAL;
using HNG.Portal.DAL.EntityClasses;
using HNG.Portal.DAL.FactoryClasses;
using HNG.Portal.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using System.Web.UI.HtmlControls;
using System.Data;
public partial class Include_inc_Banner : System.Web.UI.UserControl
{
    TblBannerManager _TblBannerManager = new TblBannerManager();
    public void LoadBanner(string Poi, string Type)
    {
        string str = "";
        TblBannerEntity _TblBannerEntity = new TblBannerEntity();
        _TblBannerEntity.LangId = HNG.LIB.Localization.LocalizationUtils.GetCurrentLanguage();
        _TblBannerEntity.SortExpression = TblBannerFields.ThuTu.Name;
        _TblBannerEntity.SortDirection = "ASC";
        _TblBannerEntity.Type = Type;
        _TblBannerEntity.ViTri = Poi;
        _TblBannerEntity.Status = "1";
        DataTable _dtBanner = _TblBannerManager.fe_selectBanner(_TblBannerEntity);
        if (_dtBanner != null && _dtBanner.Rows.Count > 0)
        {
            for (int i = 0; i < _dtBanner.Rows.Count; i++)
            {
                DataRow r = _dtBanner.Rows[i];
                if (System.IO.Path.GetExtension(r["Image"].ToString().Trim()).Equals(".swf"))
                {
                    str += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + r["Dai"].ToString() + "px\" height='" + r["Rong"].ToString() + "'>";
                    str += "<param name=\"movie\" value=\"" + Page.ResolveUrl(r["Image"].ToString()) + "\">";
                    str += "<param name=\"quality\" value=\"best\"><param name=\"play\" value=\"true\"><param name=\"wmode\" value=\"opaque\">";
                    str += "<embed src=\"" + Page.ResolveUrl(r["Image"].ToString()) + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + r["Dai"].ToString() + "px\" height='" + r["Rong"].ToString() + "' quality=\"best\" wmode=\"opaque\" play=\"true\"></embed></object>";
                }
                else
                {
                    str += "<a style=\"text-decoration:none\" href=\"" + r["Url"].ToString() + "\"><img style=\"width:" + r["Dai"].ToString() + "px;height:" + r["Rong"].ToString() + "px;border:0px\" src=\"" + Page.ResolveUrl(r["Image"].ToString()) + "\" /></a>";
                }
            }
            ltr_banner.Text += str;
        }
        if (_dtBanner.Rows.Count <= 0)
            this.Visible = false;
    }
}